<template>
  <el-table
    ref="multipleTable"
    :data="tableData"
    style="width: 100%;"
    max-height="500px"
    :size="detailSize"
    stripe
    class="table-list"
  >
    <el-table-column type="index" label="序号" width="55" align="center">
      <template scope="scope">
        <el-tooltip v-if="EnterpriseType === '1' && (scope.row.isDataTime === '1' || scope.row.isDataLocation === '1' || scope.row.isDataSpeed === '1' || scope.row.isImgTime === '1' || scope.row.isImgLocation === '1')" effect="light" content="异常" placement="right">
          <i class="el-icon-warning icon-warning " />
        </el-tooltip>
        {{ scope.$index+1 }}
      </template>
    </el-table-column>
    <el-table-column prop="explorationCode" label="勘探点编号" min-width="120" align="center" :show-overflow-tooltip="true" />
    <el-table-column
      prop="explorationType"
      label="勘探点类型"
      min-width="120"
      align="center"
      :show-overflow-tooltip="true"
      :formatter="formatExplorationType"
    />
    <el-table-column prop="x" label="坐标经度" align="center" width="180" />
    <el-table-column prop="y" label="坐标纬度" align="center" width="180" />
    <el-table-column
      prop="x1"
      label="坐 标 X"
      min-width="100"
      align="center"
      :show-overflow-tooltip="true"
    />
    <el-table-column
      prop="y1"
      label="2000Y"
      min-width="100"
      align="center"
      :show-overflow-tooltip="true"
    />
    <el-table-column
      prop="elevation"
      label="高程"
      min-width="100"
      align="center"
      :show-overflow-tooltip="true"
    />
    <el-table-column
      prop="depth"
      label="设计深度"
      min-width="100"
      align="center"
      :show-overflow-tooltip="true"
    />
    <el-table-column fixed="right" label="查看详情" align="center" width="80">
      <template slot-scope="{row}">
        <i class="el-icon-document magnifier" @click="handleExplorDetail(row.id, row.explorationCode)" />
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import { mapState } from 'vuex'
import { getEnterpriseType } from '@/utils/auth'
export default {
  name: 'ExplorationPointTable',
  props: {
    tableData: {
      type: Array,
      default: () => []
    },
    proName: {
      type: String,
      default: () => ''
    }
  },
  data() {
    return {
      EnterpriseType: getEnterpriseType() // 单位类型
    }
  },
  computed: {
    ...mapState({
      explorationType: state => state.basicInfo.explorationType // 勘探点类型全部
    })
  },
  methods: {
    // 翻译勘探点类型
    formatExplorationType(row) {
      if (row.explorationType) return this.selectDictLabel(this.explorationType, row.explorationType)
    },
    // 查看钻孔详情
    handleExplorDetail(explorationId, explorationCode) {
      this.$router.push({
        path: '/newProject/dataAcquisition',
        query: {
          explorationId,
          explorationCode,
          proName: this.proName
        }
      })
    }
  }
}
</script>

